<%= render 'admin/nav' %>
<h2>
  Admin / <%= @project.platform_name %> / <%= link_to @project, project_path(@project.to_param) %>
  <% if @project.repository.present? %>
    <%= link_to fa_icon(@project.repository.host_type.downcase), @project.repository.url, target: :blank %>
  <% end %>
</h2>
<div class="row">
  <%= simple_form_for(@project, url: admin_project_path(@project.id), html: { class: 'form-vertical col-md-8' }) do |form| %>
    <% if @project.description.present? %>
    <p>
      description: <%= @project.description %>
    </p>
    <% end %>
    <% if @project.repository.present? && @project.repository.description != @project.description %>
    <p>
      repo description: <%= @project.repository.description %>
    </p>
    <% end %>
    <p>
      <strong>Rank:</strong> <%= @project.rank %>
    </p>
    <p>
      <strong>Subscribers:</strong> <%= @project.subscriptions.count %>
    </p>

    <%= form.input :normalized_licenses, include_blank: true, selected: @project.normalized_licenses, label: 'License', collection: Spdx.licenses.keys %>
    <%= form.input :status, include_blank: true, collection: Project::STATUSES %>

    <%= form.submit class: 'btn btn-primary' %>
  <% end %>
  <div class="col-md-4">
    <%= button_to 'Delete Package', admin_project_path(@project.id), method: :delete, class: 'btn btn-danger', data: {confirm: 'Only do this if the package is gone, otherwise set status to "Hidden"'} %>
  </div>
</div>
